package com.kfm.springmybatis.service;

import com.kfm.springmybatis.dao.UserMapper;
import com.kfm.springmybatis.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public List<User> getAllUser() {
        return userMapper.selectAllByRolesUsers();
    }

    public List<User> getAllUserByRole(Integer role) {
        return userMapper.selectByRid(role);
    }
    public List<User> getAllUserByRoleAndName(String username, String password) {
        return userMapper.selectOneByUsernameAndPasswordInt(username, password);
    }


}
